<template>
	<view class="userInfo-container">
		<view class="top">
			<view class="left">
				<view class="logoBox">
					<image src="../../static/Icon/index/logo.png" mode="">
					</image>
				</view>
			</view>
			<view class="right">
				<view class="info">
					<view class="infoLeft">
						<view class="name">
							{{ownerInfo.ownerName}}
						</view>
						<view class="house">
							{{ownerInfo.houseInfo}}
						</view>
					</view>
					<view class="infoRight">
						<view class="QRcode" @click="goToQrCode">
							<image src="../../static/Icon/mine/QrCode.png" mode=""></image>
							<view class="iconfont icon-icon-test61"></view>
						</view>
					</view>
				</view>
				<view class="identyBox">
					<view class="identy">
						身份：{{ownerInfo.identity}}
					</view>
					<view class="certified">
						<view class="center">
							<view class="iconfont icon-shenfenrenzheng"></view>
							<view>已认证</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="bottom">
			<view class="line"/>
			<view class="item" @click="myInfo()">
				<view class="item-left">
					<view class="imgBox">
						<image src="../../static/Icon/mine/xinxi.png" mode=""></image>
					</view>
				</view>
				<view class="item-right">
					<view class="text">
						修改信息
					</view>
					<view class="arr">
						<text class="iconfont icon-icon-test61"></text>
					</view>
				</view>
			</view>
			<view class="item" @click="goToOrder()">
				<view class="item-left">
					<view class="imgBox">
						<image src="../../static/Icon/mine/yuyue.png" mode=""></image>
					</view>
				</view>
				<view class="item-right">
					<view class="text">
						我的预约
					</view>
					<view class="arr">
						<text class="iconfont icon-icon-test61"></text>
					</view>
				</view>
			</view>
			<view class="item" @click="goToParking()">
				<view class="item-left">
					<view class="imgBox">
						<image src="../../static/Icon/mine/cheku.png" mode=""></image>
					</view>
				</view>
				<view class="item-right">
					<view class="text">
						我的车位
					</view>
					<view class="arr">
						<text class="iconfont icon-icon-test61"></text>
					</view>
				</view>
			</view>
			<view class="item" @click="goToVisitor()">
				<view class="item-left">
					<view class="imgBox">
						<image src="../../static/Icon/mine/fangke.png" mode=""></image>
					</view>
				</view>
				<view class="item-right">
					<view class="text">
						访客记录
					</view>
					<view class="arr">
						<text class="iconfont icon-icon-test61"></text>
					</view>
				</view>
			</view>
			<view class="line"/>
			<view class="middleButton">
				<view class="logOut" @click="logOut">
					退出登陆
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{},
				ownerInfo:{}
			};
		},
		onLoad() {
			this.getUserInfo()
		},
		methods:{
			logOut(){
				uni.clearStorageSync();
				// uni.setStorage({
				// 	key:"userToken",
				// 	data:"null"
				// })
				uni.redirectTo({
					url:'../userInfoPage/login/login'
				})
			},
			myInfo(){
				uni.navigateTo({
					url:'../userInfoPage/improveInfo/improveInfo'
				})
			},

			goToVisitor(){
				uni.navigateTo({
					url:'../visitor/visitor'
				})
			},
			goToParking(){
				uni.navigateTo({
					url:'../parking/parking'
				})
			},
			goToOrder() {
				uni.navigateTo({
					url: '../facilityOrder/facilityOrder'
				});
			},
			goToQrCode(){
				uni.navigateTo({
					url:'../userInfoPage/QRcode/QRcode'
				})
			},
			getUserInfo(){
				const token = uni.getStorageSync("userToken")
				this.$myReq({
					url: '/owner/login/loginUserInfo/' + token,
					method:'GET'
				})
				.then((res) => {
					this.userInfo = res.data
					this.getOwnerInfo()
				})
			},
			getOwnerInfo(){
				this.$myReq({
					url:'/owner/ownerInfo/getOwnerInfoBySignKey/' + this.userInfo.signKey,
					method:'post'
				})
				.then((res) =>{
					this.ownerInfo = res.data
					console.log(res)
				})
				.catch((err) =>{
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: $main-garyA;
	}
	.top{
		view{
			// border: 1rpx solid red;
		}
		padding: 40rpx 40rpx 40rpx 40rpx;
		display: flex;
		flex-wrap: wrap;
		background-color: #FFFFFF;
		.left{
			.logoBox{
				margin-right: 30rpx;
				image{
					width: 130rpx;
					height: 130rpx;
					border-radius: 10rpx;
					box-shadow: 0rpx 0rpx 10rpx 5rpx #e6e6e7;
				}
			}
		}
		.right{
			width: 511rpx;//490
			.info{
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				.infoLeft{
					.name{
						font-size: 45rpx;
						font-weight: bold;
						margin-bottom: 20rpx;
						margin-top: 10rpx;
					}
					.house{
						font-size: 35rpx;
						color: $main-garyB;
						// margin-bottom: 20rpx;
					}
				}
				.infoRight{
					display: flex;
					.QRcode{
						display: flex;
						flex-wrap: wrap;
						justify-content: space-between;
						align-items: center;
						image{
							width: 40rpx;
							height: 40rpx;
						}
						view{
							font-size: 40rpx;
						}
					}
				}
			}
			.identyBox{
				display: flex;
				flex-wrap: wrap;
				padding-top: 20rpx;
				.identy{
					margin-right: 30rpx;
					height: 50rpx;
					line-height: 48rpx;
					font-size: 30rpx;
					// border: 1px solid red;
				}
				.certified{
					// height: 30rpx;
					display: flex;
					align-items: center;
					// border: 1px solid red;
					.center{
						background-color: $main-garyA;
						border-radius: 10rpx;
						// box-shadow: 0rpx 0rpx 10rpx 5rpx #e8e8ea;
						width: 120rpx;
						height: 35rpx;
						display: flex;
						flex-wrap: wrap;
						// border: 1px solid blue;
						view:nth-child(1){
							margin-left: 20rpx;
							margin-right: 5rpx;
							color: #00aa00;
							font-size: 25rpx;
							line-height: 35rpx;
							// border: 1px solid green;
						}
						view:nth-child(2){
							color: $main-garyB;
							font-size: 20rpx;
							line-height: 35rpx;
							// border: 1px solid blue;
						}
					}
				}
			}
		}
	}
	.bottom{
		// background-color: $main-garyA;
		margin-top: 20rpx;
		.item{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			// width: 750rpx;
			height: 100rpx;
			background-color: #FFFFFF;
			padding: 0rpx 40rpx;
			// border: 1px solid red;
			.item-left{
				// border: 1px solid blue;
				display: flex;
				align-items: center;
				.imgBox{
					image{
						width: 50rpx;
						height: 50rpx;
					}
				}
			}
			.item-right{
				// border: 1px solid blue;
				border-bottom: 1px solid $main-garyA;
				width: 605rpx;
				display:flex;
				flex-wrap: wrap;
				justify-content: space-between;
				.text{
					line-height: 100rpx;
				}
				.arr{
					font-size: 40rpx;
					line-height: 100rpx;
				}
			}
		}
		.line{
			background-color: white;
			height: 30rpx;
		}
		.middleButton{
			margin-top: 100rpx;
			background-color: white;
			text-align: center;
			height: 100rpx;
			line-height: 100rpx;
			font-weight: bold;
			color: #FF2B2B;
		}
	}
</style>
